﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>数据管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
    <meta content="MyraStudio" name="author" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <!-- App favicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico">

    <!-- App css -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" />
	
	
	<link href="css/font-awesome.min.css" rel="stylesheet"/>
	<!-- bootstrap-table 表格插件样式 -->
	<link href="ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
	<link href="css/animate.min.css" rel="stylesheet"/>
	<link href="css/style.min.css" rel="stylesheet"/>
	<link href="css/ry-ui.css" rel="stylesheet"/>

</head>

<body>

    <!-- Begin page -->
    <div id="layout-wrapper">

        <header id="page-topbar">
            <div class="navbar-header">

                <div class="d-flex align-items-left">
                    
                </div>

                <div class="d-flex align-items-center">

                    <div class="dropdown d-none d-sm-inline-block ml-2">
                        <button type="button" class="btn header-item noti-icon waves-effect"
                            id="page-header-search-dropdown" data-toggle="dropdown" aria-haspopup="true"
                            aria-expanded="false">
                            <i class="mdi mdi-magnify"></i>
                        </button>
                        <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right p-0"
                            aria-labelledby="page-header-search-dropdown">

                            <form class="p-3">
                                <div class="form-group m-0">
                                    <div class="input-group">
                                        <input type="text" class="form-control" placeholder="Search ..."
                                            aria-label="Recipient's username">
                                        <div class="input-group-append">
                                            <button class="btn btn-primary" type="submit"><i
                                                    class="mdi mdi-magnify"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>


                    <div class="dropdown d-inline-block ml-2">
                        <button type="button" class="btn header-item waves-effect" id="page-header-user-dropdown"
                            data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <img class="rounded-circle header-profile-user" src="assets/images/users/avatar-3.jpg"
                                alt="Header Avatar">
                            <span class="d-none d-sm-inline-block ml-1">admin</span>
                            <i class="mdi mdi-chevron-down d-none d-sm-inline-block"></i>
                        </button>
                        <div class="dropdown-menu dropdown-menu-right">
                            <a class="dropdown-item d-flex align-items-center justify-content-between"
                                href="javascript:void(0)">
                                设置
                            </a>
                            <a class="dropdown-item d-flex align-items-center justify-content-between"
                                href="javascript:void(0)">
                                <span>登出</span>
                            </a>
                        </div>
                    </div>

                </div>
            </div>
        </header>

        <!-- ========== Left Sidebar Start ========== -->
        <div class="vertical-menu">

            <div data-simplebar class="h-100">

                <div class="navbar-brand-box">
                    <a href="index.html" class="logo">
                        <!--i class="mdi mdi-alpha-x-circle"></i-->
                        <span>
                            数据管理系统
                        </span>
                    </a>
                </div>

                <!--- Sidemenu -->
                <div id="sidebar-menu">
                    <!-- Left Menu Start -->
                    <ul class="metismenu list-unstyled" id="side-menu">
                        <li class="menu-title">管理菜单</li>

                        <li>
                            <a href="../index.html" class="waves-effect"><i class="feather-airplay"></i><span>仪表盘</span></a>
                        </li>

                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>协议数据配置管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="../dictionary_config.html">字典配置</a></li>
                                <li><a href="../parselist_config.html">字段解析表配置</a></li>
                                <li><a href="../proto_field_config.html">字段配置</a></li>
                                <li><a href="../proto_config.html">协议配置</a></li>
                                <li><a href="../rule_config.html">协议规则配置</a></li>
                                <li><a href="../roto_service_config.html">协议服务配置</a></li>
                            </ul>
                        </li>
                        
                         <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>大数据配置管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="../data_rules.html">数据规则管理</a></li>
                                <li><a href="../bigdata_service_config.html">大数据服务配置</a></li>
                            </ul>
                        </li>
                        
                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>业务数据管理维护</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="../database_information_statistics.html">数据库信息展示</a></li>
                                <li><a href="../database_data_management.html">数据库数据管理</a></li>
                                <li><a href="../ordinary_file_data_management.html">普通文件数据管理</a></li>
                            </ul>
                        </li>
                        
                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>NAS数据管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="hd_nas_summary.html">访问流量统计</a></li>
                                <li><a href="hd_nas_login.html">NAS用户登录</a></li>
                            </ul>
                        </li>

                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>系统管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="hd_disk_label.html">逻辑盘符</a></li>
                                <li><a href="hd_raid_manage.html">阵列</a></li>
                                <li><a href="hd_disk_manage.html">磁盘</a></li>
                                <li><a href="hd_safe_manage.html">安全</a></li>
                                <li><a href="hd_data_space.html">数据空间</a></li>
                                <li><a href="hd_server_manage.html">服务</a></li>
                                <li><a href="hd_power_manage.html">电源</a></li>
                            </ul>
                        </li>
                        
                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>网络管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="hd_control_net.html">控制分机</a></li>
                                <li><a href="hd_save_net.html">存储分机</a></li>
                            </ul>
                        </li>
						
                        <li>
                            <a href="javascript: void(0);" class="has-arrow waves-effect"><i
                                    class="feather-copy"></i><span>用户管理</span></a>
                            <ul class="sub-menu" aria-expanded="false">
                                <li><a href="hd_system_user.html">业务用户</a></li>
                                <li><a href="hd_nas_user.html">NAS用户</a></li>
                            </ul>
                        </li>
                         
                    </ul>
                </div>
                <!-- Sidebar -->
            </div>
        </div>
        <!-- Left Sidebar End -->

        <!-- ============================================================== -->
        <!-- Start right Content here -->
        <!-- ============================================================== -->
        <div class="main-content">

<div class="page-content">
<div class="container-fluid">

		<div class="container-div">
				<div class="row">
					<div class="col-sm-12 search-collapse">
						<form id="role-form">
							<div class="select-list">
								<ul>
									<li>
										角色名称：<input type="text" name="roleName"/>
									</li>
									<li>
										权限字符：<input type="text" name="roleKey"/>
									</li>
									<li>
										角色状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
											<option value="">所有</option>
											<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
										</select>
									</li>
									<li class="select-time">
										<label>创建时间： </label>
										<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
										<span>-</span>
										<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
									</li>
									<li>
										<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
										<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
									</li>
								</ul>
							</div>
						</form>
					</div>
				
					<div class="btn-group-sm" id="toolbar" role="group">
						<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:role:add">
							<i class="fa fa-plus"></i> 新增
						</a>
						<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:role:edit">
							<i class="fa fa-edit"></i> 修改
						</a>
						<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:role:remove">
							<i class="fa fa-remove"></i> 删除
						</a>
						<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export">
							<i class="fa fa-download"></i> 导出
						</a>
					</div>
					
					<div class="col-sm-12 select-table table-striped">
						<table id="bootstrap-table"></table>
					</div>
				</div>
			</div>
            <!-- End Page-content -->
</div>
</div>
         

        </div>
        <!-- end main content-->

    </div>
    <!-- END layout-wrapper -->

    <!-- Overlay-->
    <div class="menu-overlay"></div>

    <!-- jQuery  -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/metismenu.min.js"></script>
    <script src="assets/js/waves.js"></script>
    <script src="assets/js/simplebar.min.js"></script>

    <!-- Morris Js-->
    <script src="../plugins/morris-js/morris.min.js"></script>
    <!-- Raphael Js-->
    <script src="../plugins/raphael/raphael.min.js"></script>

     <!-- Chart Js-->
   <script src="../plugins/jquery-knob/jquery.knob.min.js"></script>

    <!-- Morris Custom Js-->
    <script src="assets/pages/dashboard-demo.js"></script>

    <!-- App js -->
    <script src="assets/js/theme.js"></script>
	

	<script src="js/bootstrap.min.js"></script>
	<!-- bootstrap-table 表格插件 -->
	<script src="ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
	<script src="ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
	<!-- bootstrap-table 表格树插件 -->
	<script src="ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js"></script>
	<!-- 遮罩层 -->
	<script src="ajax/libs/blockUI/jquery.blockUI.js"></script>
    <script src="ajax/libs/iCheck/icheck.min.js"></script>
	<script src="ajax/libs/layer/layer.min.js"></script>
	<script src="ajax/libs/layui/layui.min.js"></script>
	<script src="ruoyi/js/common.js"></script>
	<script src="ruoyi/js/ry-ui.js"></script>
	
    <script th:inline="javascript">
		//var editFlag = [[${@permission.hasPermi('system:role:edit')}]];
		var editFlag = "hid";
		//var removeFlag = [[${@permission.hasPermi('system:role:remove')}]];
		var removeFlag = "hh";
		var prefix = "system/role";
		
		data = {
    "total": 2,
    "rows": [
        {
            "createBy": null,
            "createTime": "2023-10-08 10:16:49",
            "updateBy": null,
            "updateTime": null,
            "remark": "超级管理员",
            "roleId": 1,
            "roleName": "超级管理员",
            "roleKey": "admin",
            "roleSort": "1",
            "dataScope": "1",
            "status": "0",
            "delFlag": "0",
            "flag": false,
            "menuIds": null,
            "deptIds": null,
            "permissions": null,
            "admin": true
        },
        {
            "createBy": null,
            "createTime": "2023-10-08 10:16:49",
            "updateBy": null,
            "updateTime": null,
            "remark": "普通角色",
            "roleId": 2,
            "roleName": "普通角色",
            "roleKey": "common",
            "roleSort": "2",
            "dataScope": "2",
            "status": "0",
            "delFlag": "0",
            "flag": false,
            "menuIds": null,
            "deptIds": null,
            "permissions": null,
            "admin": false
        }
    ],
    "code": 0,
    "msg": null
}

		$(function() {
		    var options = {
				data:data,
		        //url: prefix + "/list",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        sortName: "roleSort",
		        modalName: "角色",
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'roleId',
		            title: '角色编号'
		        },
		        {
		            field: 'roleName',
		            title: '角色名称',
		            sortable: true
		        },
		        {
		            field: 'roleKey',
		            title: '权限字符',
		            sortable: true
		        },
		        {
		            field: 'roleSort',
		            title: '显示顺序',
		            sortable: true
		        },
		        {
		        	visible: editFlag == 'hidden' ? false : true,
		        	title: '角色状态',
		        	align: 'center',
		        	formatter: function (value, row, index) {
		        		return statusTools(row);
		        	}
		        },
		        {
		            field: 'createTime',
		            title: '创建时间',
		            sortable: true
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	if (row.roleId != 1) {
		                    var actions = [];
		                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
		                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a> ');
		                    var more = [];
		                    more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authDataScope(" + row.roleId + ")'><i class='fa fa-check-square-o'></i>数据权限</a> ");
		                    more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a>");
		                    actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
		                    return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		});
		
		/* 角色管理-分配数据权限 */
		function authDataScope(roleId) {
		    var url = prefix + '/authDataScope/' + roleId;
		    $.modal.open("分配数据权限", url);
		}
		
		/* 角色管理-分配用户 */
		function authUser(roleId) {
		    var url = prefix + '/authUser/' + roleId;
		    $.modal.openTab("分配用户", url);
		}
		
		/* 角色状态显示 */
		function statusTools(row) {
		    if (row.status == 1) {
    			return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.roleId + '\')"></i> ';
    		} else {
    			return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.roleId + '\')"></i> ';
    		}
		}
		
		/* 角色管理-停用 */
		function disable(roleId) {
			$.modal.confirm("确认要停用角色吗？", function() {
				$.operate.post(prefix + "/changeStatus", { "roleId": roleId, "status": 1 });
		    })
		}

		/* 角色管理启用 */
		function enable(roleId) {
			$.modal.confirm("确认要启用角色吗？", function() {
				$.operate.post(prefix + "/changeStatus", { "roleId": roleId, "status": 0 });
		    })
		}
	</script>

</body>

</html>